package com.qf.controller;

import com.qf.bean.Grade;
import com.qf.bean.Users;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * 2019/12/4
 * Administrator
 * springboot1204
 * 面向对象面向君  不负代码不负卿
 */
@RestController //@ResponseBody+@Controller
public class UserController {

    //http://localhost:8080/test
    @RequestMapping("/test")
    public String test1(){
        System.out.println("test111");
        return "testsuccess";
    }

    @RequestMapping("/testuser")
    public Users test2(){
        System.out.println("testuser");
        return new Users("张三",1,new Date());
    }
    @RequestMapping("/testuser3")
    public Users test4(){
        System.out.println("testuser4");
        return new Users("张三",1,new Date());
    }

    @RequestMapping("/testuser2")
    public Users test3(){
        System.out.println("testuser2");
        Grade g = new Grade(11, "一年级");
        Users users = new Users("张三", 1, new Date());
        users.setGrade(g);
       // {"username":'张三',"userid":1，"birthday":'13333333',grade:{"gid":1,"gname":'一年级'}}
        return users;
    }
}
